package com.freecloud.javabasics.design.single;

import com.freecloud.javabasics.design.entity.car.Car;
import com.freecloud.javabasics.design.entity.car.DaZhong;

/**
 * 单例：饿汉模式，在类加载期间就实例化，是线程安全的
 * @Author: maomao
 * @Date: 2019-10-30 21:04
 */
public class Hungry {

    private final static Car car = new DaZhong();

    //将构造函数私有化，防止其他方式实例化
    private Hungry(){}


    public static Car getInstance(){
        return car;
    }
}
